import java.util.Scanner;
public class NarcissisticNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=0;
        n= sc.nextInt();
        int j=100;
        for(j=100;j<=n;j++)
        {
            if((j/100)*(j/100)*(j/100)+((j/10)%10)*((j/10)%10)*((j/10)%10)+(j%10)*(j%10)*(j%10)==j) {
                System.out.println(j+"是水仙花数");
            }
           
        }
    }
}
